#filename = "/Users/admin/Documents/A-魔云/python/code/创建oracle用户表空间.txt"
class TxtFileReader:
    def __init__(self, file_path):
        self.file_path = file_path  # 存储文件路径

    def read_file(self):
        try:
            # 打开文件，'r' 表示只读模式
            with open(self.file_path, 'r') as file:
                # 读取文件的全部内容
                content = file.read().strip().replace('\n', '')
            return content
        except FileNotFoundError:  # 处理文件未找到的异常
            print(f"文件 {self.file_path} 未找到，请检查文件路径是否正确。")
        except Exception as e:  # 处理其他异常
            print(f"读取文件时出现错误: {e}")

with open("/Users/admin/Documents/A-魔云/python/code/创建oracle用户表空间.txt", 'r', encoding='gbk') as file:
    content = file.read()
    print(content)

if __name__ == '__main__':
    data = TxtFileReader("/Users/admin/Documents/A-魔云/python/code/创建oracle用户表空间.txt")
    data1 = data.read_file()
    print(data1)
